#include "DeviceMessageBuilder.h"
#include "DeviceMessageParserV2.h"
#include <iostream>

using namespace DeviceCommons;

int main() {
    try {
        std::cout << "=== DeviceCommons Static Library Test ===" << std::endl;
        
        // Test building a message
        auto builder = DeviceMessageBuilder::create()
            .withMainDevice("TestDevice", 0x01);
            
        std::vector<State> states = {
            State::makeString(1, "Hello"),
            State::makeFloat32(2, 42.0f)
        };
        builder.addReading(100, states);
        
        auto hex = builder.buildHex();
        std::cout << "Built message: " << hex << std::endl;
        
        // Test parsing the message
        auto parsed = DeviceMessageParserV2::parseFromHex(hex);
        std::cout << "Parsed successfully!" << std::endl;
        printParsedMessage(parsed);
        
        std::cout << "=== Static Library Test Completed ===" << std::endl;
        return 0;
        
    } catch (const std::exception& e) {
        std::cerr << "Error: " << e.what() << std::endl;
        return 1;
    }
}